package homework;

import java.util.HashMap;
import java.util.Scanner;

public class number7 {
public static void main(String[] args) {
	
	Scanner sc = new Scanner(System.in);
	
	System.out.println("请输入任意字符串：");
	String inputstr = sc.next();
	
	System.out.println("请再次输入任意字符串：");
	String inputstr1 = sc.next();
	
	char[] arraystr = inputstr.toCharArray();
	char[] arraystr1 = inputstr1.toCharArray();
	
	HashMap<Character, Integer> map = new HashMap<>();
	HashMap<Character, Integer> map1 = new HashMap<>();
	
	for(char c: arraystr){

		if(map.containsKey(c)){

			Integer value = map.get(c);
			value++;
			map.put(c, value);
		}else{
			map.put(c, 1);
		}
	}
	
	for(char c: arraystr1){

		if(map1.containsKey(c)){

			Integer value = map1.get(c);
			value++;
			map1.put(c, value);
		}else{
			map1.put(c, 1);
		}
	}
	
	int num = 0;
	int value = 0;
	int f = 0;
	
	for(char s: map.keySet()) {
		if(map1.containsKey(s)) {
			if(map.get(s) >= map1.get(s)) {
				num = map.get(s) - map1.get(s);
				value += num;
			}
			else {
				f = -1;
			}
		}
		
		else {
			value += map.get(s);
		}
	}
	if(f == -1) {
		System.out.println("NO");
	}
	else {
		System.out.println("YES "+value);
	}
	
}
}
